<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String validUsername = "admin";
    String validPassword = "1";

    String username = request.getParameter("username");
    String password = request.getParameter("password");
    String errorMessage = "";

    if (username != null && password != null) {
        if (username.equals(validUsername) && password.equals(validPassword)) {
            response.sendRedirect("index.jsp");
        } else {
            errorMessage = "用户名或密码错误";
        }
    }
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #D9ECF6;
            text-align: center;
            padding: 50px;
        }

        .login-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0px 0px 10px 0px #000;
            display: inline-block;
            margin-top: 70px;
            width: 400px;
        }

        input[type=text], input[type=password] {
            width: 100%;
            padding: 12px;
            margin: 8px 0;
            display: inline-block;
            border: 1px solid #ccc;
            box-sizing: border-box;
        }

        button {
            background-color: #afacac;
            color: white;
            padding: 14px 20px;
            margin: 8px 0;
            border: none;
            cursor: pointer;
            width: 100%;
            font-size: 14px;
        }

        .error-message {
            color: red;
        }
    </style>
</head>
<body>
<img src="/manager/img/logo.jpg" style="position: absolute; top: 0; left: 0; width: 231px; height: 231px;">
<form name="form1" id="form1" action="Login.jsp" method="post">
    <table border="0" style="margin-right: auto; margin-left: auto; width: 450px; font-size: 24px;">
        <tr align="center">
            <td colspan="2">
                <h1>供货商信息管理系统</h1>
            </td>
        </tr>
    </table>
    <div class="login-container">
        <h2></h2>
        <input type="text" name="username" placeholder="用户名" required>
        <input type="password" name="password" placeholder="密码" required>
        <button type="submit">登录</button>
        <div class="error-message">
            <%= errorMessage %>
        </div>
    </div>
</form>
<img src="/manager/img/bottom.png" alt="Bottom Image"
     style="width: 100%; height: 460px; display: block; margin-top: 40px;">
</body>
</html>